[Urgent] Nodes disappeared and getting 500 internal server error
Hi all,
I was trying to make a user control for publishing documents at a given time since the automated publishing schedule didn't work that well in Umbraco.
When I ran the page where the usercontrol is included, all the nodes in my news section disappeared/tree can't be expanded. I tried to use Fiddler to see what's going on and I get the following when trying to reload the news tree:
GET /umbraco/webservices/TreeDataService.ashx?rnd=11bfb4e230764bad8ba84135158b8a69&id=1088&treeType=content&contextMenu=true&isDialog=false&rnd2=52.9 HTTP/1.1
When nodes "disappear" from the tree it doesn't always have to be because the data is lost forever, sometimes it can be due to an error in the database where a node exists but refers to a parent which isn't there any more, or is unpublished, or some other error which would make representing the nodes in a tree format difficult.
Digging in is a bit tricky though - as Shannon said, the error message you've posted is a bit confusing. Just to check, did you use the Document API to do your "scheduled" publishing in your usercontrol or did you mimic a request to the URL which the context menu of the tree would normally use?
Thanks a lot for your fast replies! That's the sheer beauty of the umbraco community!
I was hoping to get a bit more detail than just the URL from Fiddler/Firebug, but there was no other information sadly :/
I solved this the hard and costly way: asking the hosting firm to revert the database to it's state yesterday - cost me 25 eur. Ah well - now it is running just as it did before and my bloodpressure is back to normal.
What strikes me is, that you asked me if I used the Document API to do my "scheduled" publishing, Alex. In fact i did :-) I used this code:
**** Warning, do NOT use this code in your project since it appearantly screws up the database! ****
protected void Page_Load(object sender, EventArgs e)
{
Document newsRoot = new Document(1088);
DateTime currentDate = DateTime.Parse(umbraco.library.CurrentDate());
foreach (Document doc in newsRoot.Children)
{
if (!doc.Published)
{
Document d = new Document(doc.Id);
DateTime publishDate = d.ReleaseDate;
if (publishDate != null && publishDate <= currentDate)
{
d.CreateDateTime = publishDate;
d.Save();
d.Publish(new User(0));
umbraco.library.UpdateDocumentCache(d.Id);
umbraco.library.RefreshContent();
}
}
}
}
What I think might cause the error is, that I new up a Document object with the current documents id in the loop - thus creating a duplicate of it?
I had to do this in order to get the ReleaseDate from the document though. If I tried to get it like this:
DateTime releaseDate = doc.ReleaseDate;
It will return 01-01-01 00:00:00 - or something like that :-)
@Jonas: the regular "Publish At:" schedule dosn't seem to work at all i.e. nothing happens at the given time, that's why I wanted to use an uptime ping service (pingdom.com) to run the above code like... every minute or so. Not a perfect solution either though.
Right, it seems like I've solved with this code (been testing it in every way possible the last two hours):
protected void Page_Load(object sender, EventArgs e)
{
Document newsRoot = new Document(1088);
DateTime currentDate = DateTime.Parse(umbraco.library.CurrentDate());
foreach (Document doc in newsRoot.Children)
{
Document d = new Document(doc.Id);
if (!d.Published)
{
DateTime publishDate = d.ReleaseDate;
if (!publishDate.ToString().Equals("01-01-0001 00:00:00") && publishDate <= currentDate)
{
doc.CreateDateTime = publishDate;
doc.Save();
doc.Publish(new User(0));
umbraco.library.RefreshContent();
umbraco.library.UpdateDocumentCache(doc.Id);
}
}
}
}
Then using pingdom.com to ping the page where the usercontrol sits with a five minute interval. While it may not be the very best solution, it feels more reliable than the built-in scheduler since this is not affected by the state of the application pool.
[Urgent] Nodes disappeared and getting 500 internal server error
Hi all,
I was trying to make a user control for publishing documents at a given time since the automated publishing schedule didn't work that well in Umbraco.
When I ran the page where the usercontrol is included, all the nodes in my news section disappeared/tree can't be expanded. I tried to use Fiddler to see what's going on and I get the following when trying to reload the news tree:
Has anyone experienced this before?
Thanks a lot in advance! :-)
/ Bo
Surely there's an error or data returned with some more detail than just the URL?
Hi Bo
Ouch, did you get any additional info in the event viewer log, or in the db umbracoLog?
What problems did you have with the automatic publisher btw?
Regards
Jonas
I experienced something similar when I activated som URL Rewriting in IIS.
Do you have any rules that remove file extensions or append trailing slash?
When nodes "disappear" from the tree it doesn't always have to be because the data is lost forever, sometimes it can be due to an error in the database where a node exists but refers to a parent which isn't there any more, or is unpublished, or some other error which would make representing the nodes in a tree format difficult.
Digging in is a bit tricky though - as Shannon said, the error message you've posted is a bit confusing. Just to check, did you use the Document API to do your "scheduled" publishing in your usercontrol or did you mimic a request to the URL which the context menu of the tree would normally use?
Hi all,
Thanks a lot for your fast replies! That's the sheer beauty of the umbraco community!
I was hoping to get a bit more detail than just the URL from Fiddler/Firebug, but there was no other information sadly :/
I solved this the hard and costly way: asking the hosting firm to revert the database to it's state yesterday - cost me 25 eur. Ah well - now it is running just as it did before and my bloodpressure is back to normal.
What strikes me is, that you asked me if I used the Document API to do my "scheduled" publishing, Alex. In fact i did :-) I used this code:
**** Warning, do NOT use this code in your project since it appearantly screws up the database! ****
What I think might cause the error is, that I new up a Document object with the current documents id in the loop - thus creating a duplicate of it?
I had to do this in order to get the ReleaseDate from the document though. If I tried to get it like this:
DateTime releaseDate = doc.ReleaseDate;
It will return 01-01-01 00:00:00 - or something like that :-)
@Jonas: the regular "Publish At:" schedule dosn't seem to work at all i.e. nothing happens at the given time, that's why I wanted to use an uptime ping service (pingdom.com) to run the above code like... every minute or so. Not a perfect solution either though.
Thanks again!
All the best,
Bo
Well, make that "the easy, but costly way" ;-)
Right, it seems like I've solved with this code (been testing it in every way possible the last two hours):
Then using pingdom.com to ping the page where the usercontrol sits with a five minute interval. While it may not be the very best solution, it feels more reliable than the built-in scheduler since this is not affected by the state of the application pool.
Any thoughts on this? :-)
/ Bo
is working on a reply...